package com.lsa.helpers.tree;

public class FindHeightWalker<T>
{
    public FindHeightWalker()
    {
    }

    public Integer walk(ITreeNode<T> node) throws Exception{
        int maxSubtreeHeight = 0;
        for( ITreeNode<T> childNode : node.getChildren() ){
            maxSubtreeHeight = Math.max(maxSubtreeHeight, walk(childNode));
        }
        
        return 1 + maxSubtreeHeight;
    }
}
